<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<style type="text/css">
	.prp_text_width1 {width:750px}
	.prp_text_width2 {width:160px}
	.prp_select_width {width:172px}
</style>
<x:parse xml="${param.xmlstr}" var="xmlData" />

<div class="t_bar">项目基本信息</div>
<table class="t_css" width="100%" border="0" cellpadding="0" id="prpInfo" cellspacing="1">
	<tr>
		<td align="right"><span class="color_red">*</span>项目名称：</td>
		  <td colspan="5">
			<input type="text" name="proposal/zh_title" label="项目名称" required class="prp_text_width1 input_css required maxlength:50" value="<x:out select="$xmlData/data/proposal/zh_title" />" maxlength="50"/> 
		  </td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>申报日期：</td>
		<td colspan="2" >
			<c:set var="submit_date"><x:out select="$xmlData/data/proposal/submit_date" /></c:set>
			<cpt:date id="submit_date" name="proposal/submit_date" value="${submit_date}" size="27" className="required date" label="申报日期"></cpt:date> 
		</td>
		<td align="right"><span class="color_red">*</span>项目实施地点：</td>
		<td colspan="2">
			<c:set var="impl_area_code"><x:out select="$xmlData/data/proposal/impl_area_code" /></c:set>
			<c:set var="impl_area_name"><x:out select="$xmlData/data/proposal/impl_area_name" /></c:set>
			<c:set var="impl_area">{'id':'${impl_area_code}','name':'${impl_area_name}'}</c:set>
			
			<input name="proposal/impl_area_code" type="hidden" value="${impl_area_code}" class="required" label="项目实施地点"/>
			<input name="proposal/impl_area_name" type="hidden" value="${impl_area_name}" />
			
			<cpt:treeAndComplete id="impl_area" width="24" topCheckbox="false"  name="impl_area" key="areaTree" onClick="initTreeValue"  value="${impl_area}" sqlParamVal=""  checkable="true"   ></cpt:treeAndComplete>
		</td>
	</tr>
	<tr>
		<td align="right">资助类别：</td>
		<td colspan="2">
			<x:out select="$xmlData/data/proposal/grant_name" /> 
		</td>
		<td align="right"><span class="color_red">*</span>合作类型：</td>
		<td colspan="2">
			<select name="cooperation_type" class="required" label="合作类型">
				<option></option>
				<option value="01">国际合作</option>
			</select>
			<input type="hidden" name="proposal/cooperation_type_value" value="01" />
			<input type="hidden" name="proposal/cooperation_type_name" value="国际合作"/>
		</td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>项目研发类型：</td>
		<td colspan="2">
			<c:set var="research_type_value"><x:out select="$xmlData/data/proposal/research_type_value" /></c:set>
			<cpt:select id="research_type" key="researchtype" value="${research_type_value}" label="项目研发类型" className="required"></cpt:select>
			<input type="hidden" name="proposal/research_type_value"  value="${research_type_value}" />
			<input type="hidden" name="proposal/research_type_name" value="<x:out select="$xmlData/data/proposal/research_type_name" />" />
		</td>
		<td align="right"><span class="color_red">*</span>密级：</td>
		<td colspan="2">
			<c:set var="secret_level_value"><x:out select="$xmlData/data/proposal/secret_level_value" /></c:set>
			<cpt:select id="secret_level" key="secret_level" value="${secret_level_value}" label="密级" className="required"></cpt:select>
			<input type="hidden" name="proposal/secret_level_value" value="${secret_level_value}" />
			<input type="hidden" name="proposal/secret_level_name" value="<x:out select="$xmlData/data/proposal/secret_level_name" />" />
		</td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>所属协议：</td>
		 <td colspan="2">
			<c:set var="agreement_type_value"><x:out select="$xmlData/data/proposal/agreement_type_value" /></c:set>
			<cpt:select id="agreement_type" key="agreement_type" value="${agreement_type_value}" label="所属协议" className="required"></cpt:select>
			<input type="hidden" name="proposal/agreement_type_value" value="${agreement_type_value}" />
			<input type="hidden" name="proposal/agreement_type_name" value="<x:out select="$xmlData/data/proposal/agreement_type_name" />" />
		  </td>
		<td align="right"><span class="color_red">*</span>协议名称：</td>
		<td colspan="2">
			<input  name="proposal/agreement_title" type="text" label="协议名称" required class="input_css required maxlength:50" maxlength="50" value="<x:out select="$xmlData/data/proposal/agreement_title" />"/> 
		</td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>协议签署日期：</td>
		<td colspan="2">
			<c:set var="agreement_signing_date"><x:out select="$xmlData/data/proposal/agreement_signing_date" /></c:set>
			<cpt:date id="agreement_signing_date" name="proposal/agreement_signing_date" value="${agreement_signing_date}" className="required date" label="协议签署日期"></cpt:date>
		  </td>
		<td align="right"><span class="color_red">*</span>协议有效期：</td>
		<td colspan="2">
			<input name="proposal/agreement_term" label="协议有效期" type="text" required class="input_css required maxlength:2" style="text-align:right;" onfocus="InitInput.setNumber(this,7,0,0)" maxlength="2" value="<x:out select="$xmlData/data/proposal/agreement_term" />"/>年 
		</td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>合作目标：</td>
	  	<td colspan="2">
			<label><input type="checkbox" name="cooperation_objectives" value="01" label="解决关键瓶颈技术" class="do">解决关键瓶颈技术</label><br/>
			<label><input type="checkbox" name="cooperation_objectives" value="03" label="引进国际优秀人才" class="do">引进国际优秀人才</label><br/>
			<label><input type="checkbox" name="cooperation_objectives" value="05" label="引进省科技战略需求的关键技术、装备" class="do">引进省科技战略需求的关键技术、装备</label><br/>
			<label><input type="checkbox" name="cooperation_objectives" value="06" label="解决省科技计划\重大专项难点、瓶颈" class="do">解决省科技计划\重大专项难点、瓶颈</label>
	  	</td>
	  	<td colspan="3">
			<label><input type="checkbox" name="cooperation_objectives" value="02" label="填补国内技术空白" class="do">填补国内技术空白</label><br/>
			<label><input type="checkbox" name="cooperation_objectives" value="04" label="引进具有重大应用前景的前瞻技术" class="do">引进具有重大应用前景的前瞻技术</label><br/>
			<label><input type="checkbox" name="cooperation_objectives" value="07" label="分享国际前沿科技成果" class="do">分享国际前沿科技成果</label><br/>
			<label><input type="checkbox" name="cooperation_objectives" value="08" label="其他" class="do">其他</label>
			
	  		<input type="hidden" name="proposal/cooperation_objectives_value" label="合作目标" class="required" value="<x:out select="$xmlData/data/proposal/cooperation_objectives_value" />" />
	  		<input type="hidden" name="proposal/cooperation_objectives_name" value="<x:out select="$xmlData/data/proposal/cooperation_objectives_name" />" />
	  	</td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>合作方式：</td>
		<td colspan="2">
			<label><input type="checkbox" name="cooperation_mode" value="01" label="购买全套技术及消化吸收" class="do">购买全套技术及消化吸收</label><br/>
			<label><input type="checkbox" name="cooperation_mode" value="03" label="引进关键技术设备" class="do">引进关键技术设备</label><br/>
			<label><input type="checkbox" name="cooperation_mode" value="06" label="赴国外技术培训" class="do">赴国外技术培训</label>
		</td>
		<td>
			<label><input type="checkbox" name="cooperation_mode" value="02" label="购买关键技术" class="do">购买关键技术</label><br/>
			<label><input type="checkbox" name="cooperation_mode" value="04" label="分工合作研发" class="do">分工合作研发</label><br/>
			<label><input type="checkbox" name="cooperation_mode" value="07" label="利用国外资源" class="do">利用国外资源</label>
		</td>
		<td colspan="2">
			<label><input type="checkbox" name="cooperation_mode" value="05" label="聘请专家来华工作" class="do">聘请专家来华工作</label><br/>
			<label><input type="checkbox" name="cooperation_mode" value="08" label="信息交流、技术咨询" class="do">信息交流、技术咨询</label><br/>
			<label><input type="checkbox" name="cooperation_mode" value="09" label="其他" class="do">其他</label>
			
			<input type="hidden" name="proposal/cooperation_mode_value" label="合作方式" class="required" value="<x:out select="$xmlData/data/proposal/cooperation_mode_value" />" />
			<input type="hidden" name="proposal/cooperation_mode_name"  value="<x:out select="$xmlData/data/proposal/cooperation_mode_name" />" />
		</td>
	</tr>
	
	<tr>
		<td align="right"><span class="color_red">*</span>项目合作协议名称：</td>
		  <td colspan="5">
			<input name="proposal/cooperation_agreement_name" label="项目合作协议名称" type="text" required class="prp_text_width1 input_css required maxlength:50" maxlength="50" value="<x:out select="$xmlData/data/proposal/cooperation_agreement_name"/>" /> 
		  </td>
	</tr>
	<tr>
		<td nowrap align="right"><span class="color_red">*</span>项目合作开始日期：</td>
		<td nowrap colspan="2"><c:set var="start_date">
				<x:out select="$xmlData/data/proposal/start_date" />
			</c:set> <cpt:date id="start_date" name="proposal/start_date"
				value="${start_date}" size="27"
				className="required date  dateCompare:end_date" label="项目合作开始日期"></cpt:date>

		</td>
		<td nowrap align="right"><span class="color_red">*</span>项目合作结束日期：</td>
		<td nowrap colspan="2"><c:set var="end_date">
				<x:out select="$xmlData/data/proposal/end_date" />
			</c:set> <cpt:date id="end_date" name="proposal/end_date"
				className="required date" label="项目合作结束日期" size="27"
				value="${end_date}"></cpt:date></td>
	</tr>
	<tr >
		<td align="right"><span class="color_red">*</span>合作国别：</td>
		<td colspan="2">
			<c:set var="cooperation_country_value"><x:out select="$xmlData/data/proposal/cooperation_country_value" /></c:set>
			<cpt:select id="cooperation_country" key="country" value="${cooperation_country_value}" label="合作国别" className="required"></cpt:select>
			<input type="hidden" name="proposal/cooperation_country_value" value="${cooperation_country_value}" />
			<input type="hidden" name="proposal/cooperation_country_name" value="<x:out select="$xmlData/data/proposal/cooperation_country_name" />" />
		</td>
		<td align="right"><span class="color_red">*</span>所属大洲：</td>
		<td colspan="2">
			<c:set var="continent_value"><x:out select="$xmlData/data/proposal/continent_value" /></c:set>
			<cpt:select id="continent" key="continent" value="${continent_value}" label="所属大洲" className="required"></cpt:select>
			<input type="hidden" name="proposal/continent_value" value="${continent_value}" />
			<input type="hidden" name="proposal/continent_name" value="<x:out select="$xmlData/data/proposal/continent_name" />" />
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>技术领域：</td>
		<td colspan="5">
			<input
			type="hidden" name="proposal/need_approve" value="${need_approve}">
			<c:set var="applicant_subject_value">
				<x:out select="$xmlData/data/proposal/applicant_subject_value" />
			</c:set> <c:set var="appl_sub_params">
			       {'grant_code':'<x:out
					select="$xmlData/data/proposal/grant_code" />','stat_year':'${statYear}'}			 
			</c:set> <input name="proposal/applicant_subject_value" type="hidden"
			value="<x:out select="$xmlData/data/proposal/applicant_subject_value" />"
			class="required " label="技术领域" /> <input
			name="proposal/applicant_subject_name" type="hidden"
			value="<x:out select="$xmlData/data/proposal/applicant_subject_name" />" />
			<cpt:select id="applicant_subject" key="applicant_subject"
				className="selectWidth2"
				onChange="initControlValue('applicant_subject')"
				value="${applicant_subject_value}" sqlParamVal="${appl_sub_params}"></cpt:select>
		</td>
	</tr>
	
	<tr>		
		<td align="right"><span class="color_red">*</span>所属专业领域1：</td>
		<td>
		    <c:set var="discipline1_code"><x:out select="$xmlData/data/proposal/discipline1_code" /></c:set>
		    <c:set var="discipline1_name"><x:out select="$xmlData/data/proposal/discipline1_name" /></c:set>
			<c:set var="discipline1">{'id':'${discipline1_code}','name':'${discipline1_name}'}</c:set>
			<c:set var="discipline1_params">{grant_code:<x:out select="$xmlData/data/proposal/grant_code" />}</c:set>
			
			<input name="proposal/discipline1_code" type="hidden" value="${discipline1_code}" />
			<input name="proposal/discipline1_name" type="hidden" value="${discipline1_name}" />
			<input id="discipline1_sqlParamVal" type="hidden" value="${discipline1_params}" />
			<cpt:treeAndComplete id="discipline1" key="discipline" name="discipline1"  value="${discipline1}"  onClick="initTreeValue" width="30" sqlParamVal="" checkable="false" className="required"  label="所属专业领域1"></cpt:treeAndComplete>
		</td>
		<td align="right"><span class="color_red">*</span>学科1：</td>
		<td>
			<c:set var="subject1_code"><x:out select="$xmlData/data/proposal/subject1_code" /></c:set>
			<c:set var="subject1_name"><x:out select="$xmlData/data/proposal/subject1_name" /></c:set>
			<c:set var="subject1">{'id':'${subject1_code}','name':'${subject1_name}'}</c:set>
			<c:set var="subject1_params">{grant_code:<x:out select="$xmlData/data/proposal/grant_code" />}</c:set>
			
			<input name="proposal/subject1_code" type="hidden" value="${subject1_code}" />
			<input name="proposal/subject1_name" type="hidden" value="${subject1_name}" />
			
			<cpt:treeAndComplete id="subject1" key="medically" onClick="initTreeValue" value="${subject1}" sqlParamVal="${subject1_params}"></cpt:treeAndComplete>
		</td>
		<td align="right">方向1：</td>
		<td>
			<input type="text" name="proposal/direction1" value="<x:out select="$xmlData/data/proposal/direction1"/>" />
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>所属专业领域2：</td>
		<td>
		    <c:set var="discipline2_code"><x:out select="$xmlData/data/proposal/discipline2_code" /></c:set>
		    <c:set var="discipline2_name"><x:out select="$xmlData/data/proposal/discipline2_name" /></c:set>
			<c:set var="discipline2">{'id':'${discipline2_code}','name':'${discipline2_name}'}</c:set>
			<c:set var="discipline2_params">{grant_code:<x:out select="$xmlData/data/proposal/grant_code" />}</c:set>
			
			<input name="proposal/discipline2_code" type="hidden" value="${discipline2_code}" />
			<input name="proposal/discipline2_name" type="hidden" value="${discipline2_name}" />
			<input id="discipline2_sqlParamVal" type="hidden" value="${discipline2_params}" />
			<cpt:treeAndComplete id="discipline2" key="discipline" name="discipline2"  value="${discipline2}"  onClick="initTreeValue" width="30" sqlParamVal="" checkable="false" className="required"  label="所属专业领域2"></cpt:treeAndComplete>
		</td>
		<td align="right"><span class="color_red">*</span>学科2：</td>
		<td>
			<c:set var="subject2_code"><x:out select="$xmlData/data/proposal/subject2_code" /></c:set>
			<c:set var="subject2_name"><x:out select="$xmlData/data/proposal/subject2_name" /></c:set>
			<c:set var="subject2">{'id':'${subject2_code}','name':'${subject2_name}'}</c:set>
			<c:set var="subject2_params">{grant_code:<x:out select="$xmlData/data/proposal/grant_code" />}</c:set>
			
			<input name="proposal/subject2_code" type="hidden" value="${subject2_code}" />
			<input name="proposal/subject2_name" type="hidden" value="${subject2_name}" />
			
			<cpt:treeAndComplete id="subject2" key="medically" onClick="initTreeValue" value="${subject2}" sqlParamVal="${subject2_params}"></cpt:treeAndComplete>
		</td>
		<td align="right">方向2：</td>
		<td>
			<input type="text" name="proposal/direction2" value="<x:out select="$xmlData/data/proposal/direction2"/>" />
		</td>
	</tr>
	<tr>
		<td align="right" width="150">项目组织（推荐）部门：</td>
		<td>
			<input name="proposal/recommendation/departments" type="text"  class="input_css maxlength:50" maxlength="50" value="<x:out select="$xmlData/data/proposal/recommendation/departments" />"/>
		</td>
		<td align="right" width="70">联系人：</td>
		<td>
			<input name="proposal/recommendation/contact" type="text"  class="input_css maxlength:50" maxlength="50" value="<x:out select="$xmlData/data/proposal/recommendation/contact" />"/>
		</td>
		<td align="right" width="70">电话：</td>
		<td>
			<input name="proposal/recommendation/tel" type="text" class="input_css maxlength:50" maxlength="50" value="<x:out select="$xmlData/data/proposal/recommendation/tel" />"/>
		</td>
	</tr>
	<tr>
		<td align="right">项目关键词：</td>
		<td colspan="5">
			<input name="proposal/key_word" type="text" class="input_css maxlength:50" maxlength="50" value="<x:out select="$xmlData/data/proposal/key_word"/>" />
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>合作内容：<br/>（100字以内）</td>
		<td colspan="5">
			<textarea name="proposal/cooperation_content" rows="3" class="input_textarea required maxlength:100 textarea" required label="合作内容" ><x:out select="$xmlData/data/proposal/cooperation_content" escapeXml="true" /></textarea>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>任务目标：<br/>（30字以内）</td>
		<td colspan="5">
			<textarea name="proposal/task_goal" rows="3" class="input_textarea required maxlength:30 textarea" required label="任务目标" ><x:out select="$xmlData/data/proposal/task_goal" escapeXml="true" /></textarea>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>合作必要性：<br/>（50字以内）</td>
		<td colspan="5">
			<textarea name="proposal/cooperation_necessity" rows="3" class="input_textarea required maxlength:50 textarea"  required label="合作必要性" ><x:out select="$xmlData/data/proposal/cooperation_necessity" escapeXml="true" /></textarea>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>成果导向：<br/>（50字以内）</td>
		<td colspan="5">
			<textarea name="proposal/product_oriented" rows="3" class="input_textarea required maxlength:50 textarea" required label="成果导向" ><x:out select="$xmlData/data/proposal/product_oriented" escapeXml="true" /></textarea>
		</td>
	</tr>
</table>

<script type="text/javascript">

$(function(){
	//设置文本框、下拉框的长度
    $("#prpInfo :text:not(.prp_text_width1)").addClass("prp_text_width2");
	$("#prpInfo textarea").addClass("prp_text_width1");
	$("#prpInfo select").addClass("prp_select_width");
	
	$("#impl_area,#discipline1,#discipline2,#subject1,#subject2").attr("disabled",true).addClass("gray");//将项目实施地点、所属专业领域和学科disabled
	
	var myDate = new Date();  
	var year=myDate.getFullYear();
	var month=myDate.getMonth()+1;
	var date=myDate.getDate(); 
	var nowDate=year+"-"+month+"-"+date;
    if($("#submit_date").val()==""){
	   $("#submit_date").val(nowDate);	//申报日期默认为当前日期
    }
});


/**
 * 选择树设置隐藏域值 public.js中原函数不适用
 */
function initTreeValue(treeId, treeNode) {

	if (!(treeNode && treeNode.level > 0)) {
		scmWarn($("#" + treeId).attr("label")
				+ messageTip.researchAreaInvalidDisciplineCode);
		if (treeNode.level == 0) {
			$("#" + treeId).val("");
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_code'],[id$='" + treeId
							+ "_code']").val("");
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_name'],[id$='" + treeId
							+ "_name']").val("");
		}
		return false;
	}
	var oldval = $("#" + treeId).parents("td").find(
			"[name$='" + treeId + "_code'],[id$='" + treeId + "_code']")
			.val();
	var oldname = $("#" + treeId).parents("td").find(
			"[name$='" + treeId + "_name'],[id$='" + treeId + "_name']")
			.val();
	oldval = $.trim(oldval);
	oldname = $.trim(oldname);
	var str = treeNode.name;
	var obj = treeNode.parentNode;
	while (obj != null) {
		str = obj.name + "-" + str;
		obj = obj.parentNode;
	}
	if (treeId == 'impl_area') {

		if (treeNode.checked) {
			if (oldname != '')
				oldname += ',';
			if (oldval != '')
				oldval += ',';
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_code'],[id$='" + treeId
							+ "_code']").val(oldval + treeNode.id);
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_name'],[id$='" + treeId
							+ "_name']").val(oldname + str);
			$("#" + treeId).parents("td").find(
					"[name='" + treeId + "'],[id='" + treeId + "']").val(
					oldname + str);
		} else {
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_code'],[id$='" + treeId
							+ "_code']").val(
					("," + oldval).replace(',' + treeNode.id, '')
							.substring(1));
			$("#" + treeId).parents("td").find(
					"[name$='" + treeId + "_name'],[id$='" + treeId
							+ "_name']").val(
					("," + oldname).replace("," + str, '').substring(1));
			$("#" + treeId).parents("td").find(
					"[name='" + treeId + "'],[id='" + treeId + "']").val(
					("," + oldname).replace("," + str, '').substring(1));
		}
	} else {
		$("#" + treeId).parents("td")
				.find(
						"[name$='" + treeId + "_code'],[id$='" + treeId
								+ "_code']").val(treeNode.id);
		$("#" + treeId).parents("td")
				.find(
						"[name$='" + treeId + "_name'],[id$='" + treeId
								+ "_name']").val(str);
	}

}
//根据参数中的显示和屏蔽模式值设置显示结果
function buildName(treeNode, params) {
	var str = treeNode.name;
	var obj = treeNode.parentNode;
	while (obj != null) {
		str = obj.name + "-" + str;
		obj = obj.parentNode;
	}
	return str;
}
</script>